门控箱相关继电器不再能直接控制屏蔽门,而是被联锁采集后由联锁发起控制;MPJ和JXTCPLJ改为仅供联锁采集

This commit is contained in:
thesai 2024-02-18 18:26:12 +08:00
parent b624eeb3d8
commit aaeb3236a8
9 changed files with 427 additions and 528 deletions

View File

@ -79,15 +79,25 @@ type PlatformMkxCircuit struct {
PCBJ *ecs.Entry
POBJ *ecs.Entry
PABJ *ecs.Entry
WRZFJ *ecs.Entry
QKQRJ *ecs.Entry
}
var MkxType = ecs.NewComponentType[Mkx]()
type Mkx struct {
PCB *ecs.Entry
PCBPL *ecs.Entry
POB *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]()
@ -97,14 +107,8 @@ type Psc struct {
//InterlockKM8 bool
InterlockKmGroup map[int32]bool //开门编组。k-编组 v-设置开门
InterlockGM bool
InterlockMPL bool
//MkxKM bool 门控箱控制继电器->联锁采集继电器状态->联锁驱动屏蔽门控制继电器
//MkxGM bool
//MkxPL bool
QDTC bool
TZTC bool
//ZAW bool
JXTCPL bool
}

View File

@ -112,15 +112,40 @@ func NewMkxEntry(world ecs.World, worldData *component.WorldData, mkx *repositor
if pcb := mkx.Pcb(); pcb != nil {
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 {
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 {
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 {
mkxComponent.MPL = NewButtonEntity(world, mpl, worldData.EntityMap)
}
if jxtcpl := mkx.Jxtcpl(); jxtcpl != nil {
mkxComponent.JXTCPL = NewButtonEntity(world, jxtcpl, worldData.EntityMap)
}
return entry
}
@ -136,6 +161,12 @@ func NewPlatformMkxEntry(world ecs.World, entryMap map[string]*ecs.Entry, mkx *r
if pabj := mkx.Pabj(); pabj != nil {
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)
return entry
}

353
fi/psd.go
View File

@ -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)
}

View File

@ -496,12 +496,23 @@ message ElectronicComponent {
message Mkx {
string id = 1;
string psdId = 2;
string pcbButtonId = 3;
string pobButtonId = 4;
string pabButtonId = 5;
string pcbjId = 6;
string pobjId = 7;
string pabjId = 8;
string pcbaId = 3; //
string pcbplaId = 4; //
string pcbjId = 5; //
string pobaId = 6; //
string pobplaId = 7; //
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 {

View File

@ -5,13 +5,24 @@ import "joylink.club/rtsssimulation/repository/model/proto"
type Mkx struct {
Identity
psd *Psd
pcb *Button
pob *Button
pab *Button
mpl *Button
pcbpl *Button
pcbj *Relay
pob *Button
pobpl *Button
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 {
@ -31,26 +42,66 @@ func (m *Mkx) Pcb() *Button {
return m.pcb
}
func (m *Mkx) Pob() *Button {
return m.pob
}
func (m *Mkx) Pab() *Button {
return m.pab
}
func (m *Mkx) Mpl() *Button {
return m.mpl
func (m *Mkx) Pcbpl() *Button {
return m.pcbpl
}
func (m *Mkx) Pcbj() *Relay {
return m.pcbj
}
func (m *Mkx) Pob() *Button {
return m.pob
}
func (m *Mkx) Pobpl() *Button {
return m.pobpl
}
func (m *Mkx) Pobj() *Relay {
return m.pobj
}
func (m *Mkx) Pab() *Button {
return m.pab
}
func (m *Mkx) Pabpl() *Button {
return m.pabpl
}
func (m *Mkx) Pabj() *Relay {
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
}

View File

@ -3165,12 +3165,23 @@ type Mkx struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,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"`
PobButtonId string `protobuf:"bytes,4,opt,name=pobButtonId,proto3" json:"pobButtonId,omitempty"`
PabButtonId string `protobuf:"bytes,5,opt,name=pabButtonId,proto3" json:"pabButtonId,omitempty"`
PcbjId string `protobuf:"bytes,6,opt,name=pcbjId,proto3" json:"pcbjId,omitempty"`
PobjId string `protobuf:"bytes,7,opt,name=pobjId,proto3" json:"pobjId,omitempty"`
PabjId string `protobuf:"bytes,8,opt,name=pabjId,proto3" json:"pabjId,omitempty"`
PcbaId string `protobuf:"bytes,3,opt,name=pcbaId,proto3" json:"pcbaId,omitempty"` //屏蔽门关门按钮
PcbplaId string `protobuf:"bytes,4,opt,name=pcbplaId,proto3" json:"pcbplaId,omitempty"` //屏蔽门关门旁路按钮
PcbjId string `protobuf:"bytes,5,opt,name=pcbjId,proto3" json:"pcbjId,omitempty"` //屏蔽门关门继电器
PobaId string `protobuf:"bytes,6,opt,name=pobaId,proto3" json:"pobaId,omitempty"` //屏蔽门开门按钮
PobplaId string `protobuf:"bytes,7,opt,name=pobplaId,proto3" json:"pobplaId,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() {
@ -3219,23 +3230,16 @@ func (x *Mkx) GetPsdId() string {
return ""
}
func (x *Mkx) GetPcbButtonId() string {
func (x *Mkx) GetPcbaId() string {
if x != nil {
return x.PcbButtonId
return x.PcbaId
}
return ""
}
func (x *Mkx) GetPobButtonId() string {
func (x *Mkx) GetPcbplaId() string {
if x != nil {
return x.PobButtonId
}
return ""
}
func (x *Mkx) GetPabButtonId() string {
if x != nil {
return x.PabButtonId
return x.PcbplaId
}
return ""
}
@ -3247,6 +3251,20 @@ func (x *Mkx) GetPcbjId() string {
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 {
if x != nil {
return x.PobjId
@ -3254,6 +3272,20 @@ func (x *Mkx) GetPobjId() string {
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 {
if x != nil {
return x.PabjId
@ -3261,6 +3293,62 @@ func (x *Mkx) GetPabjId() string {
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 {
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,
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,
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,
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,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x63, 0x62, 0x42, 0x75, 0x74, 0x74,
0x6f, 0x6e, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x6f, 0x62, 0x42, 0x75, 0x74, 0x74, 0x6f,
0x6e, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x6f, 0x62, 0x42, 0x75,
0x74, 0x74, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x62, 0x42, 0x75, 0x74,
0x74, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x61, 0x62,
0x42, 0x75, 0x74, 0x74, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x63, 0x62, 0x6a,
0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x63, 0x62, 0x6a, 0x49, 0x64,
0x12, 0x16, 0x0a, 0x06, 0x70, 0x6f, 0x62, 0x6a, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x70, 0x6f, 0x62, 0x6a, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x62, 0x6a,
0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x62, 0x6a, 0x49, 0x64,
0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x63, 0x62, 0x61, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x70, 0x63, 0x62, 0x61, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x63,
0x62, 0x70, 0x6c, 0x61, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x63,
0x62, 0x70, 0x6c, 0x61, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x63, 0x62, 0x6a, 0x49, 0x64,
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x63, 0x62, 0x6a, 0x49, 0x64, 0x12, 0x16,
0x0a, 0x06, 0x70, 0x6f, 0x62, 0x61, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x70, 0x6f, 0x62, 0x61, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x62, 0x70, 0x6c, 0x61,
0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6f, 0x62, 0x70, 0x6c, 0x61,
0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6f, 0x62, 0x6a, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x70, 0x6f, 0x62, 0x6a, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61,
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,
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,

View File

@ -217,13 +217,24 @@ func buildCentralizedStationRelationShip(source *proto.Repository, repo *Reposit
func buildMkxRelationShip(source *proto.Repository, repo *Repository) error {
for _, protoData := range source.Mkxs {
mkx := repo.mkxMap[protoData.Id]
mkx.psd = repo.psdMap[protoData.GetPsdId()]
mkx.pcb = repo.buttonMap[protoData.GetPcbButtonId()]
mkx.pob = repo.buttonMap[protoData.GetPobButtonId()]
mkx.pab = repo.buttonMap[protoData.GetPabButtonId()]
mkx.pcbj = repo.relayMap[protoData.GetPcbjId()]
mkx.pobj = repo.relayMap[protoData.GetPobjId()]
mkx.pabj = repo.relayMap[protoData.GetPabjId()]
mkx.psd = repo.psdMap[protoData.PsdId]
mkx.pcb = repo.buttonMap[protoData.PcbaId]
mkx.pcbpl = repo.buttonMap[protoData.PcbplaId]
mkx.pcbj = repo.relayMap[protoData.PcbjId]
mkx.pob = repo.buttonMap[protoData.PobaId]
mkx.pobpl = repo.buttonMap[protoData.PobplaId]
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
}

View File

@ -1,13 +1,11 @@
package circuit_sys
import (
"joylink.club/rtsssimulation/repository/model/proto"
"strings"
"joylink.club/ecs"
"joylink.club/ecs/filter"
"joylink.club/rtsssimulation/component"
"joylink.club/rtsssimulation/entity"
"joylink.club/rtsssimulation/repository/model/proto"
)
type PsdSys struct {
@ -24,35 +22,40 @@ func (p *PsdSys) Update(world ecs.World) {
worldData := entity.GetWorldData(world)
p.query.Each(world, func(entry *ecs.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)
psdState := component.PsdStateType.Get(entry)
if entry.HasComponent(component.PsdCircuitType) { //有屏蔽门电路
psdCircuit := component.PsdCircuitType.Get(entry)
//屏蔽门驱动
//更新屏蔽门电路及PSC相关状态
if psdCircuit != nil { //有屏蔽门电路
//屏蔽门关门
if psdCircuit.GMJ != nil {
p.driveGMJ(worldData, psdCircuit)
psc.InterlockGM = component.BitStateType.Get(psdCircuit.GMJ).Val
}
//屏蔽门开门
for group, kmj := range psdCircuit.KMJMap {
p.driveKMJ(worldData, psdCircuit, kmj)
psc.InterlockKmGroup[group] = component.BitStateType.Get(kmj).Val
}
//屏蔽门关
if psdCircuit.MGJ != nil {
p.driveMGJ(psdCircuit, asdList)
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 {
p.exciteQDTCJ(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 {
@ -62,48 +65,11 @@ func (p *PsdSys) Update(world ecs.World) {
} else {
psdState.Close = p.isAllAsdMotorClosed(asdList)
}
////更新站台门控箱电路及PSC相关状态
//if entry.HasComponent(component.PlatformMkxCircuitType) {
// pmc := component.PlatformMkxCircuitType.Get(entry)
// var pcbTd bool
// 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
// }
//}
//更新站台门控箱继电器状态
if mkx != nil {
pmc := component.PlatformMkxCircuitType.Get(entry)
mkxBtnDriveRelay(mkx, pmc, psdCircuit)
}
//设置滑动门电机通断电状态
repo := entity.GetWorldData(world).Repo
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) {
for i := start - 1; i < end; i++ {
asd := asdList.List[i]
@ -225,32 +202,6 @@ func (p *PsdSys) isAllAsdMotorClosed(asdList *component.AsdList) bool {
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) {
bit, err := data.QueryQdBit(component.UidType.Get(circuit.QDTCJ).Id)
if err != nil {

View 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
}