门控箱相关继电器不再能直接控制屏蔽门,而是被联锁采集后由联锁发起控制;MPJ和JXTCPLJ改为仅供联锁采集
This commit is contained in:
parent
b624eeb3d8
commit
aaeb3236a8
@ -79,15 +79,25 @@ type PlatformMkxCircuit struct {
|
|||||||
PCBJ *ecs.Entry
|
PCBJ *ecs.Entry
|
||||||
POBJ *ecs.Entry
|
POBJ *ecs.Entry
|
||||||
PABJ *ecs.Entry
|
PABJ *ecs.Entry
|
||||||
|
WRZFJ *ecs.Entry
|
||||||
|
QKQRJ *ecs.Entry
|
||||||
}
|
}
|
||||||
|
|
||||||
var MkxType = ecs.NewComponentType[Mkx]()
|
var MkxType = ecs.NewComponentType[Mkx]()
|
||||||
|
|
||||||
type Mkx struct {
|
type Mkx struct {
|
||||||
PCB *ecs.Entry
|
PCB *ecs.Entry
|
||||||
POB *ecs.Entry
|
PCBPL *ecs.Entry
|
||||||
PAB *ecs.Entry
|
POB *ecs.Entry
|
||||||
MPL *ecs.Entry
|
POBPL *ecs.Entry
|
||||||
|
PAB *ecs.Entry
|
||||||
|
PABPL *ecs.Entry
|
||||||
|
WRZF *ecs.Entry
|
||||||
|
WRZFPL *ecs.Entry
|
||||||
|
QKQR *ecs.Entry
|
||||||
|
QKQRPL *ecs.Entry
|
||||||
|
MPL *ecs.Entry
|
||||||
|
JXTCPL *ecs.Entry
|
||||||
}
|
}
|
||||||
|
|
||||||
var PscType = ecs.NewComponentType[Psc]()
|
var PscType = ecs.NewComponentType[Psc]()
|
||||||
@ -97,14 +107,8 @@ type Psc struct {
|
|||||||
//InterlockKM8 bool
|
//InterlockKM8 bool
|
||||||
InterlockKmGroup map[int32]bool //开门编组。k-编组 v-设置开门
|
InterlockKmGroup map[int32]bool //开门编组。k-编组 v-设置开门
|
||||||
InterlockGM bool
|
InterlockGM bool
|
||||||
InterlockMPL bool
|
|
||||||
|
|
||||||
//MkxKM bool 门控箱控制继电器->联锁采集继电器状态->联锁驱动屏蔽门控制继电器
|
//MkxKM bool 门控箱控制继电器->联锁采集继电器状态->联锁驱动屏蔽门控制继电器
|
||||||
//MkxGM bool
|
//MkxGM bool
|
||||||
//MkxPL bool
|
//MkxPL bool
|
||||||
|
|
||||||
QDTC bool
|
|
||||||
TZTC bool
|
|
||||||
//ZAW bool
|
|
||||||
JXTCPL bool
|
|
||||||
}
|
}
|
||||||
|
@ -112,15 +112,40 @@ func NewMkxEntry(world ecs.World, worldData *component.WorldData, mkx *repositor
|
|||||||
if pcb := mkx.Pcb(); pcb != nil {
|
if pcb := mkx.Pcb(); pcb != nil {
|
||||||
mkxComponent.PCB = NewButtonEntity(world, pcb, worldData.EntityMap)
|
mkxComponent.PCB = NewButtonEntity(world, pcb, worldData.EntityMap)
|
||||||
}
|
}
|
||||||
|
if pcbpl := mkx.Pcbpl(); pcbpl != nil {
|
||||||
|
mkxComponent.PCBPL = NewButtonEntity(world, pcbpl, worldData.EntityMap)
|
||||||
|
}
|
||||||
if pob := mkx.Pob(); pob != nil {
|
if pob := mkx.Pob(); pob != nil {
|
||||||
mkxComponent.POB = NewButtonEntity(world, pob, worldData.EntityMap)
|
mkxComponent.POB = NewButtonEntity(world, pob, worldData.EntityMap)
|
||||||
}
|
}
|
||||||
|
if pobpl := mkx.Pobpl(); pobpl != nil {
|
||||||
|
mkxComponent.POBPL = NewButtonEntity(world, pobpl, worldData.EntityMap)
|
||||||
|
}
|
||||||
if pab := mkx.Pab(); pab != nil {
|
if pab := mkx.Pab(); pab != nil {
|
||||||
mkxComponent.PAB = NewButtonEntity(world, pab, worldData.EntityMap)
|
mkxComponent.PAB = NewButtonEntity(world, pab, worldData.EntityMap)
|
||||||
}
|
}
|
||||||
|
if pabpl := mkx.Pabpl(); pabpl != nil {
|
||||||
|
mkxComponent.PABPL = NewButtonEntity(world, pabpl, worldData.EntityMap)
|
||||||
|
}
|
||||||
|
if wrzf := mkx.Wrzf(); wrzf != nil {
|
||||||
|
mkxComponent.WRZF = NewButtonEntity(world, wrzf, worldData.EntityMap)
|
||||||
|
}
|
||||||
|
if wrzfpl := mkx.Wrzfpl(); wrzfpl != nil {
|
||||||
|
mkxComponent.WRZFPL = NewButtonEntity(world, wrzfpl, worldData.EntityMap)
|
||||||
|
}
|
||||||
|
if qkqr := mkx.Qkqr(); qkqr != nil {
|
||||||
|
mkxComponent.QKQR = NewButtonEntity(world, qkqr, worldData.EntityMap)
|
||||||
|
}
|
||||||
|
if qkqrpl := mkx.Qkqrpl(); qkqrpl != nil {
|
||||||
|
mkxComponent.QKQRPL = NewButtonEntity(world, qkqrpl, worldData.EntityMap)
|
||||||
|
}
|
||||||
if mpl := mkx.Mpl(); mpl != nil {
|
if mpl := mkx.Mpl(); mpl != nil {
|
||||||
mkxComponent.MPL = NewButtonEntity(world, mpl, worldData.EntityMap)
|
mkxComponent.MPL = NewButtonEntity(world, mpl, worldData.EntityMap)
|
||||||
}
|
}
|
||||||
|
if jxtcpl := mkx.Jxtcpl(); jxtcpl != nil {
|
||||||
|
mkxComponent.JXTCPL = NewButtonEntity(world, jxtcpl, worldData.EntityMap)
|
||||||
|
}
|
||||||
|
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,6 +161,12 @@ func NewPlatformMkxEntry(world ecs.World, entryMap map[string]*ecs.Entry, mkx *r
|
|||||||
if pabj := mkx.Pabj(); pabj != nil {
|
if pabj := mkx.Pabj(); pabj != nil {
|
||||||
circuit.PABJ = NewRelayEntity(world, pabj, entryMap)
|
circuit.PABJ = NewRelayEntity(world, pabj, entryMap)
|
||||||
}
|
}
|
||||||
|
if wrzfj := mkx.Wrzfj(); wrzfj != nil {
|
||||||
|
circuit.WRZFJ = NewRelayEntity(world, wrzfj, entryMap)
|
||||||
|
}
|
||||||
|
if qkqrj := mkx.Qkqrj(); qkqrj != nil {
|
||||||
|
circuit.QKQRJ = NewRelayEntity(world, qkqrj, entryMap)
|
||||||
|
}
|
||||||
component.PlatformMkxCircuitType.Set(entry, circuit)
|
component.PlatformMkxCircuitType.Set(entry, circuit)
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
|
353
fi/psd.go
353
fi/psd.go
@ -1,353 +0,0 @@
|
|||||||
package fi
|
|
||||||
|
|
||||||
import (
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"joylink.club/ecs"
|
|
||||||
"joylink.club/rtsssimulation/component"
|
|
||||||
"joylink.club/rtsssimulation/component/component_proto"
|
|
||||||
"joylink.club/rtsssimulation/entity"
|
|
||||||
)
|
|
||||||
|
|
||||||
func SetInterlockKm(world ecs.World, psdId string, group int32) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
entry, ok := wd.EntityMap[psdId]
|
|
||||||
if ok {
|
|
||||||
err := setInterlockKm(wd, entry, group)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", psdId))
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func CancelInterlockKm(world ecs.World, id string, group int32) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
entry, ok := wd.EntityMap[id]
|
|
||||||
if ok {
|
|
||||||
err := cancelInterlockKm(wd, entry, group)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetInterlockGm(world ecs.World, id string) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
entry, ok := wd.EntityMap[id]
|
|
||||||
if ok {
|
|
||||||
err := setInterlockGm(wd, entry)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func CancelInterlockGm(world ecs.World, id string) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
entry, ok := wd.EntityMap[id]
|
|
||||||
if ok {
|
|
||||||
err := cancelInterlockGm(wd, entry)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetPsdFault(world ecs.World, id string, fault component_proto.Psd_Fault, asdCodes []int32) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
psdEntry, ok := wd.EntityMap[id]
|
|
||||||
if !ok {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
tag, err := component.GetAsdFaultTag(fault)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
asdList := component.AsdListType.Get(psdEntry).List
|
|
||||||
for _, code := range asdCodes {
|
|
||||||
asdEntry := asdList[int(code-1)]
|
|
||||||
asdEntry.AddComponent(tag)
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func CancelPsdFault(world ecs.World, id string, fault component_proto.Psd_Fault, asdCodes []int32) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
psdEntry, ok := wd.EntityMap[id]
|
|
||||||
if !ok {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
tag, err := component.GetAsdFaultTag(fault)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
asdList := component.AsdListType.Get(psdEntry).List
|
|
||||||
for _, code := range asdCodes {
|
|
||||||
asdEntry := asdList[int(code-1)]
|
|
||||||
asdEntry.RemoveComponent(tag)
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetQDTC(world ecs.World, id string) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
entry, ok := wd.EntityMap[id]
|
|
||||||
if ok {
|
|
||||||
err := setQDTC(wd, entry)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func CancelQDTC(world ecs.World, id string) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
entry, ok := wd.EntityMap[id]
|
|
||||||
if ok {
|
|
||||||
err := cancelQDTC(wd, entry)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetTZTC(world ecs.World, id string) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
entry, ok := wd.EntityMap[id]
|
|
||||||
if ok {
|
|
||||||
err := setTZTC(wd, entry)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func CancelTZTC(world ecs.World, id string) error {
|
|
||||||
result := <-ecs.Request[ecs.EmptyType](world, func() ecs.Result[ecs.EmptyType] {
|
|
||||||
wd := entity.GetWorldData(world)
|
|
||||||
entry, ok := wd.EntityMap[id]
|
|
||||||
if ok {
|
|
||||||
err := cancelTZTC(wd, entry)
|
|
||||||
if err != nil {
|
|
||||||
return ecs.NewErrResult(err)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ecs.NewErrResult(fmt.Errorf("未找到id=%s的屏蔽门", id))
|
|
||||||
}
|
|
||||||
return ecs.NewOkEmptyResult()
|
|
||||||
})
|
|
||||||
return result.Err
|
|
||||||
}
|
|
||||||
|
|
||||||
func cancelTZTC(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) {
|
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
|
||||||
return wd.SetQdBit(component.UidType.Get(circuit.TZTCJ).Id, false)
|
|
||||||
} else {
|
|
||||||
psc := component.PscType.Get(psdEntry)
|
|
||||||
psc.TZTC = false
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func setTZTC(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) {
|
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
|
||||||
return wd.SetQdBits([]*component.QdBitParam{
|
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.QDTCJ).Id, false),
|
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.TZTCJ).Id, true),
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
psc := component.PscType.Get(psdEntry)
|
|
||||||
psc.QDTC = false
|
|
||||||
psc.TZTC = true
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func cancelQDTC(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) {
|
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
|
||||||
return wd.SetQdBit(component.UidType.Get(circuit.QDTCJ).Id, false)
|
|
||||||
} else {
|
|
||||||
psc := component.PscType.Get(psdEntry)
|
|
||||||
psc.QDTC = false
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func setQDTC(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) {
|
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
|
||||||
return wd.SetQdBits([]*component.QdBitParam{
|
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.QDTCJ).Id, true),
|
|
||||||
component.NewQdBitParam(component.UidType.Get(circuit.TZTCJ).Id, false),
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
psc := component.PscType.Get(psdEntry)
|
|
||||||
psc.QDTC = true
|
|
||||||
psc.TZTC = false
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置联锁开门
|
|
||||||
func setInterlockKm(wd *component.WorldData, psdEntry *ecs.Entry, group int32) error {
|
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
|
||||||
if circuit.KMJMap[0] != nil { //0编组意味着屏蔽门仅有一个开门继电器
|
|
||||||
return setRelayDriveKm(wd, circuit, 0)
|
|
||||||
} else {
|
|
||||||
kmj := circuit.KMJMap[group]
|
|
||||||
if kmj == nil {
|
|
||||||
id := component.UidType.Get(psdEntry).Id
|
|
||||||
return errors.New(fmt.Sprintf("屏蔽门[id:%s]不支持[%d]编组操作", id, group))
|
|
||||||
}
|
|
||||||
return setRelayDriveKm(wd, circuit, group)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
psc := component.PscType.Get(psdEntry)
|
|
||||||
psc.InterlockKmGroup[group] = true
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 取消联锁开门
|
|
||||||
func cancelInterlockKm(wd *component.WorldData, psdEntry *ecs.Entry, group int32) error {
|
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
|
||||||
if circuit.KMJMap[0] != nil { //0编组意味着屏蔽门仅有一个开门继电器
|
|
||||||
return cancelRelayDriveKm(wd, circuit, 0)
|
|
||||||
} else {
|
|
||||||
kmj := circuit.KMJMap[group]
|
|
||||||
if kmj == nil {
|
|
||||||
id := component.UidType.Get(psdEntry).Id
|
|
||||||
return errors.New(fmt.Sprintf("屏蔽门[id:%s]不支持[%d]编组操作", id, group))
|
|
||||||
}
|
|
||||||
return cancelRelayDriveKm(wd, circuit, group)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
psc := component.PscType.Get(psdEntry)
|
|
||||||
psc.InterlockKmGroup[group] = false
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置联锁关门
|
|
||||||
func setInterlockGm(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
|
||||||
return setRelayDriveGm(wd, circuit)
|
|
||||||
} else {
|
|
||||||
psc := component.PscType.Get(psdEntry)
|
|
||||||
for i, _ := range psc.InterlockKmGroup {
|
|
||||||
psc.InterlockKmGroup[i] = false
|
|
||||||
}
|
|
||||||
psc.InterlockGM = true
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 取消联锁关门
|
|
||||||
func cancelInterlockGm(wd *component.WorldData, psdEntry *ecs.Entry) error {
|
|
||||||
if psdEntry.HasComponent(component.PsdCircuitType) { //有联锁区段电路
|
|
||||||
circuit := component.PsdCircuitType.Get(psdEntry)
|
|
||||||
return cancelRelayDriveGm(wd, circuit)
|
|
||||||
} else {
|
|
||||||
psc := component.PscType.Get(psdEntry)
|
|
||||||
psc.InterlockGM = false
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置继电器驱动开门
|
|
||||||
func setRelayDriveKm(wd *component.WorldData, circuit *component.PsdCircuit, group int32) error {
|
|
||||||
var params []*component.QdBitParam
|
|
||||||
params = append(params, component.NewQdBitParam(component.UidType.Get(circuit.GMJ).Id, false))
|
|
||||||
for g, entry := range circuit.KMJMap {
|
|
||||||
if g == group {
|
|
||||||
params = append(params, component.NewQdBitParam(component.UidType.Get(entry).Id, true))
|
|
||||||
} else {
|
|
||||||
params = append(params, component.NewQdBitParam(component.UidType.Get(entry).Id, false))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return wd.SetQdBits(params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 取消继电器驱动开门
|
|
||||||
func cancelRelayDriveKm(wd *component.WorldData, circuit *component.PsdCircuit, group int32) error {
|
|
||||||
var params []*component.QdBitParam
|
|
||||||
for _, entry := range circuit.KMJMap {
|
|
||||||
params = append(params, component.NewQdBitParam(component.UidType.Get(entry).Id, false))
|
|
||||||
}
|
|
||||||
|
|
||||||
return wd.SetQdBits(params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置继电器驱动关门
|
|
||||||
func setRelayDriveGm(wd *component.WorldData, circuit *component.PsdCircuit) error {
|
|
||||||
var params []*component.QdBitParam
|
|
||||||
params = append(params, component.NewQdBitParam(component.UidType.Get(circuit.GMJ).Id, true))
|
|
||||||
for _, entry := range circuit.KMJMap {
|
|
||||||
params = append(params, component.NewQdBitParam(component.UidType.Get(entry).Id, false))
|
|
||||||
}
|
|
||||||
|
|
||||||
return wd.SetQdBits(params)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 取消继电器驱动关门
|
|
||||||
func cancelRelayDriveGm(wd *component.WorldData, circuit *component.PsdCircuit) error {
|
|
||||||
var params []*component.QdBitParam
|
|
||||||
params = append(params, component.NewQdBitParam(component.UidType.Get(circuit.GMJ).Id, false))
|
|
||||||
|
|
||||||
return wd.SetQdBits(params)
|
|
||||||
}
|
|
@ -496,12 +496,23 @@ message ElectronicComponent {
|
|||||||
message Mkx {
|
message Mkx {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
string psdId = 2;
|
string psdId = 2;
|
||||||
string pcbButtonId = 3;
|
string pcbaId = 3; //屏蔽门关门按钮
|
||||||
string pobButtonId = 4;
|
string pcbplaId = 4; //屏蔽门关门旁路按钮
|
||||||
string pabButtonId = 5;
|
string pcbjId = 5; //屏蔽门关门继电器
|
||||||
string pcbjId = 6;
|
string pobaId = 6; //屏蔽门开门按钮
|
||||||
string pobjId = 7;
|
string pobplaId = 7; //屏蔽门开门旁路按钮
|
||||||
string pabjId = 8;
|
string pobjId = 8; //屏蔽门开门继电器
|
||||||
|
string pabaId = 9; //站台发车按钮
|
||||||
|
string pabplaId = 10; //站台发车旁路按钮
|
||||||
|
string pabjId = 11; //站台发车继电器
|
||||||
|
string wrzfaId = 12; //无人折返按钮
|
||||||
|
string wrzfplaId = 13; //无人折返旁路按钮
|
||||||
|
string wrzfjId = 14; //无人折返继电器
|
||||||
|
string qkqraId = 15; //清客确认按钮
|
||||||
|
string qkqrplaId = 16; //清客确认旁路按钮
|
||||||
|
string qkqrjId = 17; //清客确认继电器
|
||||||
|
string mplaId = 18; //互锁接触按钮
|
||||||
|
string jxtcplaId = 19; //间隙探测旁路按钮
|
||||||
}
|
}
|
||||||
//站台
|
//站台
|
||||||
message Platform {
|
message Platform {
|
||||||
|
@ -4,14 +4,25 @@ import "joylink.club/rtsssimulation/repository/model/proto"
|
|||||||
|
|
||||||
type Mkx struct {
|
type Mkx struct {
|
||||||
Identity
|
Identity
|
||||||
psd *Psd
|
psd *Psd
|
||||||
pcb *Button
|
|
||||||
pob *Button
|
pcb *Button
|
||||||
pab *Button
|
pcbpl *Button
|
||||||
mpl *Button
|
pcbj *Relay
|
||||||
pcbj *Relay
|
pob *Button
|
||||||
pobj *Relay
|
pobpl *Button
|
||||||
pabj *Relay
|
pobj *Relay
|
||||||
|
pab *Button
|
||||||
|
pabpl *Button
|
||||||
|
pabj *Relay
|
||||||
|
wrzf *Button
|
||||||
|
wrzfpl *Button
|
||||||
|
wrzfj *Relay
|
||||||
|
qkqr *Button
|
||||||
|
qkqrpl *Button
|
||||||
|
qkqrj *Relay
|
||||||
|
mpl *Button
|
||||||
|
jxtcpl *Button
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMkx(id string) *Mkx {
|
func NewMkx(id string) *Mkx {
|
||||||
@ -31,26 +42,66 @@ func (m *Mkx) Pcb() *Button {
|
|||||||
return m.pcb
|
return m.pcb
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Mkx) Pob() *Button {
|
func (m *Mkx) Pcbpl() *Button {
|
||||||
return m.pob
|
return m.pcbpl
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Mkx) Pab() *Button {
|
|
||||||
return m.pab
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Mkx) Mpl() *Button {
|
|
||||||
return m.mpl
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Mkx) Pcbj() *Relay {
|
func (m *Mkx) Pcbj() *Relay {
|
||||||
return m.pcbj
|
return m.pcbj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Pob() *Button {
|
||||||
|
return m.pob
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Pobpl() *Button {
|
||||||
|
return m.pobpl
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Mkx) Pobj() *Relay {
|
func (m *Mkx) Pobj() *Relay {
|
||||||
return m.pobj
|
return m.pobj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Pab() *Button {
|
||||||
|
return m.pab
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Pabpl() *Button {
|
||||||
|
return m.pabpl
|
||||||
|
}
|
||||||
|
|
||||||
func (m *Mkx) Pabj() *Relay {
|
func (m *Mkx) Pabj() *Relay {
|
||||||
return m.pabj
|
return m.pabj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Wrzf() *Button {
|
||||||
|
return m.wrzf
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Wrzfpl() *Button {
|
||||||
|
return m.wrzfpl
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Wrzfj() *Relay {
|
||||||
|
return m.wrzfj
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Qkqr() *Button {
|
||||||
|
return m.qkqr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Qkqrpl() *Button {
|
||||||
|
return m.qkqrpl
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Qkqrj() *Relay {
|
||||||
|
return m.qkqrj
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Mpl() *Button {
|
||||||
|
return m.mpl
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Mkx) Jxtcpl() *Button {
|
||||||
|
return m.jxtcpl
|
||||||
|
}
|
||||||
|
@ -3163,14 +3163,25 @@ type Mkx struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
PsdId string `protobuf:"bytes,2,opt,name=psdId,proto3" json:"psdId,omitempty"`
|
PsdId string `protobuf:"bytes,2,opt,name=psdId,proto3" json:"psdId,omitempty"`
|
||||||
PcbButtonId string `protobuf:"bytes,3,opt,name=pcbButtonId,proto3" json:"pcbButtonId,omitempty"`
|
PcbaId string `protobuf:"bytes,3,opt,name=pcbaId,proto3" json:"pcbaId,omitempty"` //屏蔽门关门按钮
|
||||||
PobButtonId string `protobuf:"bytes,4,opt,name=pobButtonId,proto3" json:"pobButtonId,omitempty"`
|
PcbplaId string `protobuf:"bytes,4,opt,name=pcbplaId,proto3" json:"pcbplaId,omitempty"` //屏蔽门关门旁路按钮
|
||||||
PabButtonId string `protobuf:"bytes,5,opt,name=pabButtonId,proto3" json:"pabButtonId,omitempty"`
|
PcbjId string `protobuf:"bytes,5,opt,name=pcbjId,proto3" json:"pcbjId,omitempty"` //屏蔽门关门继电器
|
||||||
PcbjId string `protobuf:"bytes,6,opt,name=pcbjId,proto3" json:"pcbjId,omitempty"`
|
PobaId string `protobuf:"bytes,6,opt,name=pobaId,proto3" json:"pobaId,omitempty"` //屏蔽门开门按钮
|
||||||
PobjId string `protobuf:"bytes,7,opt,name=pobjId,proto3" json:"pobjId,omitempty"`
|
PobplaId string `protobuf:"bytes,7,opt,name=pobplaId,proto3" json:"pobplaId,omitempty"` //屏蔽门开门旁路按钮
|
||||||
PabjId string `protobuf:"bytes,8,opt,name=pabjId,proto3" json:"pabjId,omitempty"`
|
PobjId string `protobuf:"bytes,8,opt,name=pobjId,proto3" json:"pobjId,omitempty"` //屏蔽门开门继电器
|
||||||
|
PabaId string `protobuf:"bytes,9,opt,name=pabaId,proto3" json:"pabaId,omitempty"` //站台发车按钮
|
||||||
|
PabplaId string `protobuf:"bytes,10,opt,name=pabplaId,proto3" json:"pabplaId,omitempty"` //站台发车旁路按钮
|
||||||
|
PabjId string `protobuf:"bytes,11,opt,name=pabjId,proto3" json:"pabjId,omitempty"` //站台发车继电器
|
||||||
|
WrzfaId string `protobuf:"bytes,12,opt,name=wrzfaId,proto3" json:"wrzfaId,omitempty"` //无人折返按钮
|
||||||
|
WrzfplaId string `protobuf:"bytes,13,opt,name=wrzfplaId,proto3" json:"wrzfplaId,omitempty"` //无人折返旁路按钮
|
||||||
|
WrzfjId string `protobuf:"bytes,14,opt,name=wrzfjId,proto3" json:"wrzfjId,omitempty"` //无人折返继电器
|
||||||
|
QkqraId string `protobuf:"bytes,15,opt,name=qkqraId,proto3" json:"qkqraId,omitempty"` //清客确认按钮
|
||||||
|
QkqrplaId string `protobuf:"bytes,16,opt,name=qkqrplaId,proto3" json:"qkqrplaId,omitempty"` //清客确认旁路按钮
|
||||||
|
QkqrjId string `protobuf:"bytes,17,opt,name=qkqrjId,proto3" json:"qkqrjId,omitempty"` //清客确认继电器
|
||||||
|
MplaId string `protobuf:"bytes,18,opt,name=mplaId,proto3" json:"mplaId,omitempty"` //互锁接触按钮
|
||||||
|
JxtcplaId string `protobuf:"bytes,19,opt,name=jxtcplaId,proto3" json:"jxtcplaId,omitempty"` //间隙探测旁路按钮
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Mkx) Reset() {
|
func (x *Mkx) Reset() {
|
||||||
@ -3219,23 +3230,16 @@ func (x *Mkx) GetPsdId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Mkx) GetPcbButtonId() string {
|
func (x *Mkx) GetPcbaId() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.PcbButtonId
|
return x.PcbaId
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Mkx) GetPobButtonId() string {
|
func (x *Mkx) GetPcbplaId() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.PobButtonId
|
return x.PcbplaId
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *Mkx) GetPabButtonId() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.PabButtonId
|
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -3247,6 +3251,20 @@ func (x *Mkx) GetPcbjId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetPobaId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PobaId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetPobplaId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PobplaId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *Mkx) GetPobjId() string {
|
func (x *Mkx) GetPobjId() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.PobjId
|
return x.PobjId
|
||||||
@ -3254,6 +3272,20 @@ func (x *Mkx) GetPobjId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetPabaId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PabaId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetPabplaId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.PabplaId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *Mkx) GetPabjId() string {
|
func (x *Mkx) GetPabjId() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.PabjId
|
return x.PabjId
|
||||||
@ -3261,6 +3293,62 @@ func (x *Mkx) GetPabjId() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetWrzfaId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.WrzfaId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetWrzfplaId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.WrzfplaId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetWrzfjId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.WrzfjId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetQkqraId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.QkqraId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetQkqrplaId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.QkqrplaId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetQkqrjId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.QkqrjId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetMplaId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.MplaId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Mkx) GetJxtcplaId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.JxtcplaId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// 站台
|
// 站台
|
||||||
type Platform struct {
|
type Platform struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
@ -5653,20 +5741,37 @@ var file_model_proto_rawDesc = []byte{
|
|||||||
0x64, 0x12, 0x31, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18,
|
0x64, 0x12, 0x31, 0x0a, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18,
|
||||||
0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65,
|
0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x44, 0x65,
|
||||||
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65,
|
0x76, 0x69, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0a, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65,
|
||||||
0x54, 0x79, 0x70, 0x65, 0x22, 0xd9, 0x01, 0x0a, 0x03, 0x4d, 0x6b, 0x78, 0x12, 0x0e, 0x0a, 0x02,
|
0x54, 0x79, 0x70, 0x65, 0x22, 0xe9, 0x03, 0x0a, 0x03, 0x4d, 0x6b, 0x78, 0x12, 0x0e, 0x0a, 0x02,
|
||||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05,
|
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05,
|
||||||
0x70, 0x73, 0x64, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x73, 0x64,
|
0x70, 0x73, 0x64, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x73, 0x64,
|
||||||
0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x63, 0x62, 0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x49,
|
0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x63, 0x62, 0x61, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x63, 0x62, 0x42, 0x75, 0x74, 0x74,
|
0x28, 0x09, 0x52, 0x06, 0x70, 0x63, 0x62, 0x61, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x63,
|
||||||
0x6f, 0x6e, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x6f, 0x62, 0x42, 0x75, 0x74, 0x74, 0x6f,
|
0x62, 0x70, 0x6c, 0x61, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x63,
|
||||||
0x6e, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6f, 0x62, 0x42, 0x75,
|
0x62, 0x70, 0x6c, 0x61, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x63, 0x62, 0x6a, 0x49, 0x64,
|
||||||
0x74, 0x74, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x62, 0x42, 0x75, 0x74,
|
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x63, 0x62, 0x6a, 0x49, 0x64, 0x12, 0x16,
|
||||||
0x74, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x61, 0x62,
|
0x0a, 0x06, 0x70, 0x6f, 0x62, 0x61, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
||||||
0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x63, 0x62, 0x6a,
|
0x70, 0x6f, 0x62, 0x61, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x62, 0x70, 0x6c, 0x61,
|
||||||
0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x63, 0x62, 0x6a, 0x49, 0x64,
|
0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x62, 0x70, 0x6c, 0x61,
|
||||||
0x12, 0x16, 0x0a, 0x06, 0x70, 0x6f, 0x62, 0x6a, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
|
0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6f, 0x62, 0x6a, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01,
|
||||||
0x52, 0x06, 0x70, 0x6f, 0x62, 0x6a, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x62, 0x6a,
|
0x28, 0x09, 0x52, 0x06, 0x70, 0x6f, 0x62, 0x6a, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61,
|
||||||
0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x62, 0x6a, 0x49, 0x64,
|
0x62, 0x61, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x62, 0x61,
|
||||||
|
0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x62, 0x70, 0x6c, 0x61, 0x49, 0x64, 0x18, 0x0a,
|
||||||
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x62, 0x70, 0x6c, 0x61, 0x49, 0x64, 0x12, 0x16,
|
||||||
|
0x0a, 0x06, 0x70, 0x61, 0x62, 0x6a, 0x49, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
||||||
|
0x70, 0x61, 0x62, 0x6a, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x72, 0x7a, 0x66, 0x61, 0x49,
|
||||||
|
0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x77, 0x72, 0x7a, 0x66, 0x61, 0x49, 0x64,
|
||||||
|
0x12, 0x1c, 0x0a, 0x09, 0x77, 0x72, 0x7a, 0x66, 0x70, 0x6c, 0x61, 0x49, 0x64, 0x18, 0x0d, 0x20,
|
||||||
|
0x01, 0x28, 0x09, 0x52, 0x09, 0x77, 0x72, 0x7a, 0x66, 0x70, 0x6c, 0x61, 0x49, 0x64, 0x12, 0x18,
|
||||||
|
0x0a, 0x07, 0x77, 0x72, 0x7a, 0x66, 0x6a, 0x49, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
|
0x07, 0x77, 0x72, 0x7a, 0x66, 0x6a, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x71, 0x6b, 0x71, 0x72,
|
||||||
|
0x61, 0x49, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x71, 0x6b, 0x71, 0x72, 0x61,
|
||||||
|
0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x71, 0x6b, 0x71, 0x72, 0x70, 0x6c, 0x61, 0x49, 0x64, 0x18,
|
||||||
|
0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x6b, 0x71, 0x72, 0x70, 0x6c, 0x61, 0x49, 0x64,
|
||||||
|
0x12, 0x18, 0x0a, 0x07, 0x71, 0x6b, 0x71, 0x72, 0x6a, 0x49, 0x64, 0x18, 0x11, 0x20, 0x01, 0x28,
|
||||||
|
0x09, 0x52, 0x07, 0x71, 0x6b, 0x71, 0x72, 0x6a, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x70,
|
||||||
|
0x6c, 0x61, 0x49, 0x64, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x70, 0x6c, 0x61,
|
||||||
|
0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x78, 0x74, 0x63, 0x70, 0x6c, 0x61, 0x49, 0x64, 0x18,
|
||||||
|
0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6a, 0x78, 0x74, 0x63, 0x70, 0x6c, 0x61, 0x49, 0x64,
|
||||||
0x22, 0xef, 0x01, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a,
|
0x22, 0xef, 0x01, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a,
|
||||||
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
|
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a,
|
||||||
0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64,
|
0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64,
|
||||||
|
@ -217,13 +217,24 @@ func buildCentralizedStationRelationShip(source *proto.Repository, repo *Reposit
|
|||||||
func buildMkxRelationShip(source *proto.Repository, repo *Repository) error {
|
func buildMkxRelationShip(source *proto.Repository, repo *Repository) error {
|
||||||
for _, protoData := range source.Mkxs {
|
for _, protoData := range source.Mkxs {
|
||||||
mkx := repo.mkxMap[protoData.Id]
|
mkx := repo.mkxMap[protoData.Id]
|
||||||
mkx.psd = repo.psdMap[protoData.GetPsdId()]
|
mkx.psd = repo.psdMap[protoData.PsdId]
|
||||||
mkx.pcb = repo.buttonMap[protoData.GetPcbButtonId()]
|
mkx.pcb = repo.buttonMap[protoData.PcbaId]
|
||||||
mkx.pob = repo.buttonMap[protoData.GetPobButtonId()]
|
mkx.pcbpl = repo.buttonMap[protoData.PcbplaId]
|
||||||
mkx.pab = repo.buttonMap[protoData.GetPabButtonId()]
|
mkx.pcbj = repo.relayMap[protoData.PcbjId]
|
||||||
mkx.pcbj = repo.relayMap[protoData.GetPcbjId()]
|
mkx.pob = repo.buttonMap[protoData.PobaId]
|
||||||
mkx.pobj = repo.relayMap[protoData.GetPobjId()]
|
mkx.pobpl = repo.buttonMap[protoData.PobplaId]
|
||||||
mkx.pabj = repo.relayMap[protoData.GetPabjId()]
|
mkx.pobj = repo.relayMap[protoData.PobjId]
|
||||||
|
mkx.pab = repo.buttonMap[protoData.PabaId]
|
||||||
|
mkx.pabpl = repo.buttonMap[protoData.PabplaId]
|
||||||
|
mkx.pabj = repo.relayMap[protoData.PabjId]
|
||||||
|
mkx.wrzf = repo.buttonMap[protoData.WrzfaId]
|
||||||
|
mkx.wrzfpl = repo.buttonMap[protoData.WrzfplaId]
|
||||||
|
mkx.wrzfj = repo.relayMap[protoData.WrzfjId]
|
||||||
|
mkx.qkqr = repo.buttonMap[protoData.QkqraId]
|
||||||
|
mkx.qkqrpl = repo.buttonMap[protoData.QkqrplaId]
|
||||||
|
mkx.qkqrj = repo.relayMap[protoData.QkqrjId]
|
||||||
|
mkx.mpl = repo.buttonMap[protoData.MplaId]
|
||||||
|
mkx.jxtcpl = repo.buttonMap[protoData.JxtcplaId]
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package circuit_sys
|
package circuit_sys
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"joylink.club/rtsssimulation/repository/model/proto"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"joylink.club/ecs"
|
"joylink.club/ecs"
|
||||||
"joylink.club/ecs/filter"
|
"joylink.club/ecs/filter"
|
||||||
"joylink.club/rtsssimulation/component"
|
"joylink.club/rtsssimulation/component"
|
||||||
"joylink.club/rtsssimulation/entity"
|
"joylink.club/rtsssimulation/entity"
|
||||||
|
"joylink.club/rtsssimulation/repository/model/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PsdSys struct {
|
type PsdSys struct {
|
||||||
@ -24,35 +22,40 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
worldData := entity.GetWorldData(world)
|
worldData := entity.GetWorldData(world)
|
||||||
p.query.Each(world, func(entry *ecs.Entry) {
|
p.query.Each(world, func(entry *ecs.Entry) {
|
||||||
psc := component.PscType.Get(entry)
|
psc := component.PscType.Get(entry)
|
||||||
//更新屏蔽门电路及PSC相关状态
|
var psdCircuit *component.PsdCircuit
|
||||||
|
if entry.HasComponent(component.PsdCircuitType) {
|
||||||
|
psdCircuit = component.PsdCircuitType.Get(entry)
|
||||||
|
}
|
||||||
|
var mkx *component.Mkx
|
||||||
|
if entry.HasComponent(component.PlatformMkxCircuitType) {
|
||||||
|
pmc := component.PlatformMkxCircuitType.Get(entry)
|
||||||
|
if len(pmc.MkxList) > 0 {
|
||||||
|
mkx = component.MkxType.Get(pmc.MkxList[0])
|
||||||
|
}
|
||||||
|
}
|
||||||
asdList := component.AsdListType.Get(entry)
|
asdList := component.AsdListType.Get(entry)
|
||||||
psdState := component.PsdStateType.Get(entry)
|
psdState := component.PsdStateType.Get(entry)
|
||||||
if entry.HasComponent(component.PsdCircuitType) { //有屏蔽门电路
|
//更新屏蔽门电路及PSC相关状态
|
||||||
psdCircuit := component.PsdCircuitType.Get(entry)
|
if psdCircuit != nil { //有屏蔽门电路
|
||||||
//屏蔽门驱动
|
//屏蔽门关门
|
||||||
if psdCircuit.GMJ != nil {
|
if psdCircuit.GMJ != nil {
|
||||||
p.driveGMJ(worldData, psdCircuit)
|
p.driveGMJ(worldData, psdCircuit)
|
||||||
psc.InterlockGM = component.BitStateType.Get(psdCircuit.GMJ).Val
|
psc.InterlockGM = component.BitStateType.Get(psdCircuit.GMJ).Val
|
||||||
}
|
}
|
||||||
|
//屏蔽门开门
|
||||||
for group, kmj := range psdCircuit.KMJMap {
|
for group, kmj := range psdCircuit.KMJMap {
|
||||||
p.driveKMJ(worldData, psdCircuit, kmj)
|
p.driveKMJ(worldData, psdCircuit, kmj)
|
||||||
psc.InterlockKmGroup[group] = component.BitStateType.Get(kmj).Val
|
psc.InterlockKmGroup[group] = component.BitStateType.Get(kmj).Val
|
||||||
}
|
}
|
||||||
|
//屏蔽门关
|
||||||
if psdCircuit.MGJ != nil {
|
if psdCircuit.MGJ != nil {
|
||||||
p.driveMGJ(psdCircuit, asdList)
|
p.driveMGJ(psdCircuit, asdList)
|
||||||
psdState.Close = component.BitStateType.Get(psdCircuit.MGJ).Val
|
psdState.Close = component.BitStateType.Get(psdCircuit.MGJ).Val
|
||||||
}
|
}
|
||||||
//if psdCircuit.MPLJ != nil { 此继电器代表互锁接触,仅需要给联锁采集
|
|
||||||
// p.driveMPLJ(world, psdCircuit, component.UidType.Get(entry))
|
|
||||||
// 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.TZTC = component.BitStateType.Get(psdCircuit.TZTCJ).Val
|
|
||||||
}
|
}
|
||||||
//间隙探测
|
//间隙探测
|
||||||
if psdCircuit.ZAWJ != nil {
|
if psdCircuit.ZAWJ != nil {
|
||||||
@ -62,48 +65,11 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
} else {
|
} else {
|
||||||
psdState.Close = p.isAllAsdMotorClosed(asdList)
|
psdState.Close = p.isAllAsdMotorClosed(asdList)
|
||||||
}
|
}
|
||||||
////更新站台门控箱电路及PSC相关状态
|
//更新站台门控箱继电器状态
|
||||||
//if entry.HasComponent(component.PlatformMkxCircuitType) {
|
if mkx != nil {
|
||||||
// pmc := component.PlatformMkxCircuitType.Get(entry)
|
pmc := component.PlatformMkxCircuitType.Get(entry)
|
||||||
// var pcbTd bool
|
mkxBtnDriveRelay(mkx, pmc, psdCircuit)
|
||||||
// var pobTd bool
|
}
|
||||||
// var pabTd bool
|
|
||||||
// for _, mkxEntry := range pmc.MkxList {
|
|
||||||
// mkx := component.MkxType.Get(mkxEntry)
|
|
||||||
// //门控箱站台门关闭
|
|
||||||
// pcb := component.BitStateType.Get(mkx.PCB)
|
|
||||||
// if !pcb.BypassEnable {
|
|
||||||
// if mkx.PCB != nil && pcb.Val {
|
|
||||||
// pcbTd = true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //门控箱站台门打开
|
|
||||||
// pob := component.BitStateType.Get(mkx.POB)
|
|
||||||
// if !pob.BypassEnable {
|
|
||||||
// if mkx.POB != nil && pob.Val {
|
|
||||||
// pobTd = true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //门控箱站台确认
|
|
||||||
// pab := component.BitStateType.Get(mkx.PAB)
|
|
||||||
// if !pab.BypassEnable {
|
|
||||||
// if mkx.PAB != nil && pab.Val {
|
|
||||||
// pabTd = true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if pmc.PCBJ != nil {
|
|
||||||
// component.RelayDriveType.Get(pmc.PCBJ).Td = pcbTd
|
|
||||||
// psc.MkxGM = component.BitStateType.Get(pmc.PCBJ).Val
|
|
||||||
// }
|
|
||||||
// if pmc.POBJ != nil {
|
|
||||||
// component.RelayDriveType.Get(pmc.POBJ).Td = pobTd
|
|
||||||
// psc.MkxKM = component.BitStateType.Get(pmc.POBJ).Val
|
|
||||||
// }
|
|
||||||
// if pmc.PABJ != nil {
|
|
||||||
// component.RelayDriveType.Get(pmc.PABJ).Td = pabTd
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//设置滑动门电机通断电状态
|
//设置滑动门电机通断电状态
|
||||||
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)
|
||||||
@ -122,30 +88,41 @@ func (p *PsdSys) Update(world ecs.World) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//if psc.MkxKM { //优先门控箱的开门
|
|
||||||
// p.allKm(asdList)
|
|
||||||
//} else if psc.MkxGM { //其次门控箱的关门
|
|
||||||
// p.gm(asdList)
|
|
||||||
//} else if !psc.InterlockMPL { //联锁操作没有被旁路
|
|
||||||
// if psc.InterlockGM {
|
|
||||||
// p.gm(asdList)
|
|
||||||
// } else {
|
|
||||||
// for group, km := range psc.InterlockKmGroup {
|
|
||||||
// if km {
|
|
||||||
// var asdGroup *proto.AsdGroup
|
|
||||||
// if group == 0 {
|
|
||||||
// asdGroup = psd.FindFirstAsdGroup()
|
|
||||||
// } else {
|
|
||||||
// asdGroup = psd.FindAsdGroup(group)
|
|
||||||
// }
|
|
||||||
// p.km(asdGroup.Start, asdGroup.End, asdList)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 门控箱按钮驱动继电器
|
||||||
|
func mkxBtnDriveRelay(mkx *component.Mkx, pmc *component.PlatformMkxCircuit, psdCircuit *component.PsdCircuit) {
|
||||||
|
//PCB
|
||||||
|
pcbpl := component.BitStateType.Get(mkx.PCBPL).Val
|
||||||
|
pcb := component.BitStateType.Get(mkx.PCB).Val
|
||||||
|
component.RelayDriveType.Get(pmc.PCBJ).Td = !pcbpl && pcb
|
||||||
|
//POB
|
||||||
|
pobpl := component.BitStateType.Get(mkx.POBPL).Val
|
||||||
|
pob := component.BitStateType.Get(mkx.POB).Val
|
||||||
|
component.RelayDriveType.Get(pmc.POBJ).Td = !pobpl && pob
|
||||||
|
//PAB
|
||||||
|
pabpl := component.BitStateType.Get(mkx.PABPL).Val
|
||||||
|
pab := component.BitStateType.Get(mkx.PAB).Val
|
||||||
|
component.RelayDriveType.Get(pmc.PABJ).Td = !pabpl && pab
|
||||||
|
//WRZF
|
||||||
|
wrzfpl := component.BitStateType.Get(mkx.WRZFPL).Val
|
||||||
|
wrzf := component.BitStateType.Get(mkx.WRZF).Val
|
||||||
|
component.RelayDriveType.Get(pmc.WRZFJ).Td = !wrzfpl && wrzf
|
||||||
|
//QKQR
|
||||||
|
qkqrpl := component.BitStateType.Get(mkx.QKQRPL).Val
|
||||||
|
qkqr := component.BitStateType.Get(mkx.QKQR).Val
|
||||||
|
component.RelayDriveType.Get(pmc.QKQRJ).Td = !qkqrpl && qkqr
|
||||||
|
//MPL
|
||||||
|
if psdCircuit != nil {
|
||||||
|
component.RelayDriveType.Get(psdCircuit.MPLJ).Td = component.BitStateType.Get(mkx.MPL).Val
|
||||||
|
}
|
||||||
|
//JXTCPL
|
||||||
|
if psdCircuit != nil {
|
||||||
|
component.RelayDriveType.Get(psdCircuit.JXTCPLJ).Td = component.BitStateType.Get(mkx.JXTCPL).Val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (p *PsdSys) km(start int32, end int32, asdList *component.AsdList) {
|
func (p *PsdSys) km(start int32, end int32, asdList *component.AsdList) {
|
||||||
for i := start - 1; i < end; i++ {
|
for i := start - 1; i < end; i++ {
|
||||||
asd := asdList.List[i]
|
asd := asdList.List[i]
|
||||||
@ -225,32 +202,6 @@ func (p *PsdSys) isAllAsdMotorClosed(asdList *component.AsdList) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PsdSys) driveMPLJ(world ecs.World, circuit *component.PsdCircuit, uid *component.Uid) {
|
|
||||||
data := entity.GetWorldData(world)
|
|
||||||
psd := data.Repo.FindPsd(uid.Id)
|
|
||||||
platform := psd.Platform()
|
|
||||||
station := platform.Station()
|
|
||||||
|
|
||||||
var buttonCode string
|
|
||||||
if strings.Contains(platform.Code(), "上行") {
|
|
||||||
buttonCode = "S旁路"
|
|
||||||
} else if strings.Contains(platform.Code(), "下行") {
|
|
||||||
buttonCode = "X旁路"
|
|
||||||
} else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
for _, button := range station.SpksButtons() {
|
|
||||||
if button.Code() != buttonCode {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
btnEntry, ok := entity.GetEntityByUid(world, button.Id())
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
component.RelayDriveType.Get(circuit.MPLJ).Td = component.BitStateType.Get(btnEntry).Val
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *PsdSys) exciteQDTCJ(data *component.WorldData, circuit *component.PsdCircuit) {
|
func (p *PsdSys) exciteQDTCJ(data *component.WorldData, circuit *component.PsdCircuit) {
|
||||||
bit, err := data.QueryQdBit(component.UidType.Get(circuit.QDTCJ).Id)
|
bit, err := data.QueryQdBit(component.UidType.Get(circuit.QDTCJ).Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
88
sys/circuit_sys/psd_test.go
Normal file
88
sys/circuit_sys/psd_test.go
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
package circuit_sys
|
||||||
|
|
||||||
|
import (
|
||||||
|
"joylink.club/ecs"
|
||||||
|
"joylink.club/rtsssimulation/component"
|
||||||
|
"math/rand"
|
||||||
|
"strconv"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test_mkxBtnDriveRelay(t *testing.T) {
|
||||||
|
for i := 0; i < 100; i++ {
|
||||||
|
mkx, pmc, psdCircuit := generateTestCase()
|
||||||
|
t.Run(strconv.Itoa(i), func(t *testing.T) {
|
||||||
|
mkxBtnDriveRelay(mkx, pmc, psdCircuit)
|
||||||
|
if component.BitStateType.Get(mkx.PCB).Val && !component.BitStateType.Get(mkx.PCBPL).Val != component.RelayDriveType.Get(pmc.PCBJ).Td {
|
||||||
|
panic("PCB对应的继电器状态不对")
|
||||||
|
}
|
||||||
|
if component.BitStateType.Get(mkx.POB).Val && !component.BitStateType.Get(mkx.POBPL).Val != component.RelayDriveType.Get(pmc.POBJ).Td {
|
||||||
|
panic("POB对应的继电器状态不对")
|
||||||
|
}
|
||||||
|
if component.BitStateType.Get(mkx.PAB).Val && !component.BitStateType.Get(mkx.PABPL).Val != component.RelayDriveType.Get(pmc.PABJ).Td {
|
||||||
|
panic("PAB对应的继电器状态不对")
|
||||||
|
}
|
||||||
|
if component.BitStateType.Get(mkx.WRZF).Val && !component.BitStateType.Get(mkx.WRZFPL).Val != component.RelayDriveType.Get(pmc.WRZFJ).Td {
|
||||||
|
panic("WRZF对应的继电器状态不对")
|
||||||
|
}
|
||||||
|
if component.BitStateType.Get(mkx.QKQR).Val && !component.BitStateType.Get(mkx.QKQRPL).Val != component.RelayDriveType.Get(pmc.QKQRJ).Td {
|
||||||
|
panic("QKQR对应的继电器状态不对")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func generateTestCase() (*component.Mkx, *component.PlatformMkxCircuit, *component.PsdCircuit) {
|
||||||
|
world := ecs.NewWorld(100)
|
||||||
|
mkx := &component.Mkx{
|
||||||
|
PCB: newButtonEntity(world, "PCB", rand.Int()%2 == 0),
|
||||||
|
PCBPL: newButtonEntity(world, "PCBPL", rand.Int()%2 == 0),
|
||||||
|
POB: newButtonEntity(world, "POB", rand.Int()%2 == 0),
|
||||||
|
POBPL: newButtonEntity(world, "POBPL", rand.Int()%2 == 0),
|
||||||
|
PAB: newButtonEntity(world, "PAB", rand.Int()%2 == 0),
|
||||||
|
PABPL: newButtonEntity(world, "PABPL", rand.Int()%2 == 0),
|
||||||
|
WRZF: newButtonEntity(world, "WRZF", rand.Int()%2 == 0),
|
||||||
|
WRZFPL: newButtonEntity(world, "WRZFPL", rand.Int()%2 == 0),
|
||||||
|
QKQR: newButtonEntity(world, "QKQR", rand.Int()%2 == 0),
|
||||||
|
QKQRPL: newButtonEntity(world, "QKQRPL", rand.Int()%2 == 0),
|
||||||
|
MPL: newButtonEntity(world, "MPL", rand.Int()%2 == 0),
|
||||||
|
JXTCPL: newButtonEntity(world, "JXTCPL", rand.Int()%2 == 0),
|
||||||
|
}
|
||||||
|
rand.Int()
|
||||||
|
pmc := &component.PlatformMkxCircuit{
|
||||||
|
MkxList: nil,
|
||||||
|
PCBJ: newRelayEntry(world, "PCBJ"),
|
||||||
|
POBJ: newRelayEntry(world, "POBJ"),
|
||||||
|
PABJ: newRelayEntry(world, "PABJ"),
|
||||||
|
WRZFJ: newRelayEntry(world, "WRZFJ"),
|
||||||
|
QKQRJ: newRelayEntry(world, "QKQRJ"),
|
||||||
|
}
|
||||||
|
psdCircuit := &component.PsdCircuit{
|
||||||
|
GMJ: nil,
|
||||||
|
KMJMap: nil,
|
||||||
|
MGJ: nil,
|
||||||
|
MPLJ: newRelayEntry(world, "MPLJ"),
|
||||||
|
QDTCJ: nil,
|
||||||
|
TZTCJ: nil,
|
||||||
|
ZAWJ: nil,
|
||||||
|
JXTCPLJ: newRelayEntry(world, "JXTCPLJ"),
|
||||||
|
UnusedJ: nil,
|
||||||
|
}
|
||||||
|
return mkx, pmc, psdCircuit
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRelayEntry(w ecs.World, uid string) *ecs.Entry {
|
||||||
|
entry := w.Entry(w.Create(component.RelayTag, component.UidType, component.RelayDriveType, component.BitStateType))
|
||||||
|
component.UidType.SetValue(entry, component.Uid{Id: uid})
|
||||||
|
entry.AddComponent(component.YjRelayTag)
|
||||||
|
return entry
|
||||||
|
}
|
||||||
|
|
||||||
|
func newButtonEntity(w ecs.World, uid string, val bool) *ecs.Entry {
|
||||||
|
btnType := component.NoResetPressBtn
|
||||||
|
entry := w.Entry(w.Create(component.ButtonTag, btnType, component.UidType, component.BitStateType))
|
||||||
|
component.UidType.SetValue(entry, component.Uid{Id: uid})
|
||||||
|
component.BitStateType.SetValue(entry, component.BitState{Val: val})
|
||||||
|
return entry
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user